from celery import shared_task
from celery.utils.log import get_task_logger
from .models import db, Message


logger = get_task_logger(__name__)


@shared_task
def add2(msg):
    message = Message(details=msg)
    db.session.add(message)
    db.session.commit()
    return "success"



@shared_task
def hello_celery(name):
    logger.info(f"hello {name}")
    return "success"